package face.pay.web.mch.controller.store;

import face.pay.system.annotation.CurrentUser;
import face.pay.common.enterprise.service.IStoreInfoBaseService;
import face.pay.entity.StoreInfo;
import face.pay.entity.UserInfo;
import face.pay.util.ResultMessage;
import face.pay.util.page.PageData;
import face.pay.util.page.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: zkj
 * @Date: 2019/7/15 09:37
 * @Description:商户门店管理
 */
@Controller
@RequestMapping("/enterprise_store")
public class StoreInfoController {

    @Autowired
    private IStoreInfoBaseService iStoreInfoBaseService;

    @RequestMapping("/list")
    public String manager(){

        return  "enterprise/store_list";
    }


    @RequestMapping("/edit")
    @ResponseBody
    public ResultMessage editUser(@CurrentUser UserInfo loginUser, StoreInfo storeInfo) {

        return iStoreInfoBaseService.modifyInfo(storeInfo,loginUser);

    }

    @RequestMapping("/queryData")
    @ResponseBody
    public PageData data(PageParam pageParam, StoreInfo storeInfo,@CurrentUser UserInfo userInfo) {

        storeInfo.setUserId(userInfo.getId());
        return  this.iStoreInfoBaseService.queryPage(storeInfo,pageParam);

    }

    @RequestMapping("getStores")
    @ResponseBody
    public ResultMessage getStores(StoreInfo storeInfo,@CurrentUser UserInfo userInfo)  {

        storeInfo.setUserId(userInfo.getId());
        return  this.iStoreInfoBaseService.getStores(storeInfo);

    }



}
